﻿Imports System.Web.UI
Imports SISSAT.BusinessLayer.DomainModels
Imports SISSAT.Administration.Views

Namespace Pages.Administration
    Public Class Employees
        Inherits Page
        Implements IEmployeeView

#Region "Properties"

        Private Property Presenter As EmployeePresenter

#End Region

#Region "IEmployeeView Members"

        Public ReadOnly Property EmployeeCode As String Implements IEmployeeView.EmployeeCode
            Get
                Dim code As String = HttpContext.Current.Request.QueryString("code")
                If Not String.IsNullOrEmpty(code) OrElse String.Compare(code, "new", True) = 0 Then
                    ' No logic
                Else
                    code = String.Empty
                End If

                Return code
            End Get
        End Property

        Public WriteOnly Property RepeaterDataSource As IEnumerable(Of Employee) Implements IEmployeeView.RepeaterDataSource
            Set(value As IEnumerable(Of Employee))
                EmployeeRepeater.DataSource = value
                EmployeeRepeater.DataBind()
            End Set
        End Property

        Public Event OnInitialization() Implements IEmployeeView.OnInitialization

#End Region

#Region "Events"

        Private Sub PageInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            If Not String.IsNullOrEmpty(Me.EmployeeCode) Then
                EmployeeViews.ActiveViewIndex = 1
            End If

            Presenter = New EmployeePresenter(Me)
            RaiseEvent OnInitialization()
        End Sub

#End Region

    End Class
End Namespace
